<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{title}}</title>
    <link href="/apps/css/bootstrap.min.css" rel="stylesheet">
    <link href="/apps/css/fontawesome-free-6.4.0-web/css/all.css" rel="stylesheet">
    <link href="/apps/css/bootstrap-datepicker.min.css" rel="stylesheet">
    <link href="/apps/css/mui.css" rel="stylesheet">
    <style>
        .search-form {
            margin-bottom: 20px;
            padding: 15px;
            background-color: #f8f9fa;
            border-radius: 5px;
        }
        .table th {
            background-color: #f8f9fa;
        }
        .form-group {
            margin-bottom: 10px;
        }
        .btn-search {
            margin-top: 24px;
        }
        .download-section {
            margin: 10px 0;
            text-align: right;
        }
        .page-info {
            display: inline-block;
            margin-right: 15px;
            vertical-align: middle;
        }
    </style>
    <script src="/apps/js/baidu-tongji-mtx.js"></script>
</head>
<body>
    <div class="container-fluid">
        <h2 class="mt-4">{{title}}</h2>
        <p class="text-muted">{{description}}</p>

        <div class="search-form">
            <form method="GET" action="/apps/loyalty/admin/refunds">
                <div class="row">
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>时间范围</label>
                            <div class="input-group">
                                <input type="text" class="form-control datepicker" name="begin" value="{{begin}}" autocomplete="off">
                                <div class="input-group-append">
                                    <span class="input-group-text">至</span>
                                </div>
                                <input type="text" class="form-control datepicker" name="end" value="{{end}}" autocomplete="off">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label>每页显示</label>
                            <select class="form-control" name="limit">
                                <option value="20" {{#if (eq limit 20)}}selected{{/if}}>20条/页</option>
                                <option value="50" {{#if (eq limit 50)}}selected{{/if}}>50条/页</option>
                                <option value="100" {{#if (eq limit 100)}}selected{{/if}}>100条/页</option>
                                <option value="200" {{#if (eq limit 200)}}selected{{/if}}>200条/页</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label>用户号</label>
                            <input type="text" class="form-control" name="uid" value="{{uid}}" placeholder="用户ID">
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label>渠道号</label>
                            <input type="text" class="form-control" name="spread_uid" value="{{spread_uid}}" placeholder="渠道ID">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>退款类型</label>
                            <select class="form-control" name="refund_type">
                                <option value="weixin" {{#if (eq refund_type "weixin")}}selected{{/if}}>微信退款</option>
                                <option value="tupay" {{#if (eq refund_type "tupay")}}selected{{/if}}>图贝退款</option>
                                <option value="all" {{#if (eq refund_type "all")}}selected{{/if}}>全部</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-2">
                        <div class="form-group">
                            <label>代表代码</label>
                            <input type="text" class="form-control" name="rep_code" value="{{rep_code}}" placeholder="代表代码">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>用户名称</label>
                            <input type="text" class="form-control" name="real_name" value="{{real_name}}" placeholder="用户名称">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>用户手机</label>
                            <input type="text" class="form-control" name="user_phone" value="{{user_phone}}" placeholder="用户手机">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>用户地址</label>
                            <input type="text" class="form-control" name="user_address" value="{{user_address}}" placeholder="用户地址">
                        </div>
                    </div>
                    <div class="col-md-1">
                        <button type="submit" class="btn btn-primary btn-block btn-search">
                            <i class="fas fa-search"></i> 查询
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <div class="download-section">
            {{{downloadLink}}}
        </div>

        <div class="table-responsive">
            <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>退款时间</th>
                        <th>支付时间</th>
                        <th>订单号</th>
                        <th>用户号</th>
                        <th>渠道号</th>
                        <th>代表代码</th>
                        <th>用户/订单信息</th>
                        <th>退款金额</th>
                        <th>剩余金额</th>
                        <th>退款类型</th>
                        <th>退款备注</th>
                    </tr>
                </thead>
                <tbody>
                    {{#each rows}}
                    <tr>
                        <td>{{this.refund_time}}</td>
                        <td>{{this.pay_time}}</td>
                        <td>{{this.order_id}}</td>
                        <td>{{this.uid}}</td>
                        <td>{{this.channel_id}}</td>
                        <td>{{this.rep_code}}</td>
                        <td>
                            <div>姓名: {{this.real_name}}</div>
                            <div>电话: {{this.user_phone}} </div>
                            <div>地址: {{this.user_address}}</div>
                            <div>订单金额: ¥{{this.order_amount}}</div>
                        </td>
                        <td>¥{{this.refund_amount}}</td>
                        <td>¥{{this.remaining_balance}}</td>
                        <td>{{this.refund_type}}</td>
                        <td>{{this.refund_remark}}</td>
                    </tr>
                    {{/each}}
                </tbody>
            </table>
        </div>

        <div>
            共 {{total}} 条记录，当前显示第 {{startRecord}} 条到第 {{endRecord}} 条
            <ul class="pagination">
            {{{paginator}}}
            </ul>
        </div>
    </div>

    <script src="/apps/js/jquery.min.js"></script>
    <script src="/apps/js/bootstrap.bundle.min.js"></script>
    <script src="/apps/js/bootstrap-datepicker.min.js"></script>
    <script src="/apps/js/bootstrap-datepicker.zh-CN.min.js"></script>
    <script>
        $(document).ready(function() {
            $('.datepicker').datepicker({
                format: 'yyyy-mm-dd',
                language: 'zh-CN',
                autoclose: true
            });
        });
    </script>
</body>
</html> 
